# -*- coding: UTF-8 -*-
import random
result = []
def login():
    global result
    input_value = int(input('请输入验证码长度：'))
    print(input_value)
    count = 0
    while (count < input_value):
        count += 1
        row = {}
        num_start = ['134', '135', '136', '137', '138', '139', '150', '151', '152', '158', '159', '157', '182', '187',
                     '188', '147', '130', '131', '132', '155', '156', '185', '186', '133', '153', '180', '189']
        start = random.choice(num_start)
        last = "".join(str(random.randint(0, 9)) for i in range(8))
        num = start + last
        row.update({'phone': num})
        #print('账号', num)

        x = random.randint(65, 90)
        strs = []
        index1 = random.randint(1, 14)
        if index1 >= 6 & index1 <= 14:
            index2 = random.randint(1, (15 - index1))
        else:
            index2 = random.randint((7 - index1), (15 - index1))
        for m in range(index1):
            x = random.randint(65, 90)
            strs.append(chr(x))
        for n in range(index2):
            x = random.randint(65, 90)
            strs.append(chr(x).lower())
        length = len(strs)
        index3 = random.randint(0, (length - 1))
        strs.insert(index3, '_')
        length2 = len(strs)
        index4 = random.randint(0, 16 - length2)
        for p in range(index4):
            x = random.randint(0, 9)
            length3 = len(strs)
            index5 = random.randint(0, (length - 1))
            strs.insert(index5, str(x))
        #print('密码', ''.join(strs))
        row.update({'password': ''.join(strs)})
        result.append(row)


login()
print(result)